#pragma once
#include <RCGame.h>
#include <RCCamera.h>
#include <RCSpriteBatch.h>
//#include <RCSound.h>
#include <RCSoundWav.h>

#include <list>
#include <algorithm>

using namespace RCDX11;
using namespace DirectX;

class MyGame : public RCGame
{
protected:
	ID3D11ShaderResourceView *pMineTexture;
	ID3D11ShaderResourceView *pShipTexture;

	RCSpriteBatch* spriteBatch;

	ID3D11ShaderResourceView* mainBG;
	ID3D11ShaderResourceView* layer1;
	ID3D11ShaderResourceView* layer2;

	ID3D11ShaderResourceView* laser;
	ID3D11ShaderResourceView* bangTexture;

	ID3D11ShaderResourceView* whitePixel;

	float bg;
	float l1;
	float l2;

	XMFLOAT2 playerPos;

	XMFLOAT2 mines[5];

	XMFLOAT2 lasers[4];
	bool activeLaser[4];

	struct BangAnim
	{
	public:
		BangAnim(XMFLOAT2 pos)
		{
			position = pos;
			frame = 0;
		}
		XMFLOAT2 position;
		float frame;
	};

	std::list<std::shared_ptr<BangAnim>> explosion;

	ID3D11PixelShader*  pPixelShader;

	ID3D11Texture2D* m_renderTargetTexture;
	ID3D11RenderTargetView* m_renderTargetView;
	ID3D11ShaderResourceView* m_shaderResourceView;

	//RCSound laserSound;
	RCSoundWav laserSound;
	RCSoundWav bangSound;

public:
	MyGame(void);
	~MyGame(void);


	void HandleKeyboardInput();
	void Update(float time, std::vector<IUpdateable*>* updateables);
	void Draw(float time, std::vector<IDrawable*>* drawables);


	void Initialize();

	float rotation;
	float rotation2;

	void SetPS();
};

